package com.woniuxy.config;

import com.woniuxy.interceptor.LoginInterceptor;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration配置类需要添加
@Configuration
@AllArgsConstructor
public class WebConfig implements WebMvcConfigurer {
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login","/user/loginBtn","/js/**","/css/**","/img/**")
                .order(1);//数字越小  执行优先率越大
    }
}
